<?php
return array(
    'router' => array(
        'routes' => array(
 		     'frontend' => array(
        				'type' => 'Zend\Mvc\Router\Http\Literal',
        				'options' => array(
        						'route'    => '/',
        						'defaults' => array(        								
        								'controller' => 'FrontEnd\Controller\Index',
        								'action'     => 'index',
        						),
        				),
        				'may_terminate' => true,
        				'child_routes' => array(
        						'default' => array(
        								'type'    => 'Segment',
        								'options' => array(
        										'route'    => '[:action][/:id]',
        										'constraints' => array(
        												'action'=> '[a-zA-Z][a-zA-Z0-9_-]*',
        												'id' => '[0-9,]+',
        												
        										),
        										'defaults' => array(
        												'controller'    => 'FrontEnd\Controller\Index',
        												'action'        => 'index',
        										),
        								),
        								
        						),
        						
        						
        		        ),
  	
        		),
        		
        		'rss' => array(
        				'type' => 'Literal',
        				'options' => array(
        						'route'    => '/rss',
        						'defaults' => array(
        								'controller'    => 'FrontEnd\Controller\Rss',
        								'action'        => 'feed',
        						),
        				),
        		),
        		
        		'pagesfrontend' => array(
        				'type' => 'Segment',
        				'options' => array(
        						'route' => '[/search_by/:search_by][/page-:page][.html]',
        						'constraints' => array(
        								'page' => '[1-9][0-9]*',
        								'search_by' => '[^/]*',
        						),
        						'defaults' => array(
        								'controller' => 'FrontEnd\Controller\Index',
        								'action'        => 'index',
        								'page'          => '1'
        						), ), ),
        		
        		'product_detail' => array(
        				'type' => 'Regex',
        				'options' => array(
        						'regex' => '/video/(?<id>[\/a-zA-Z0-9_-]+)(\.(?<format>(json|html|xml|rss)))?',
        						'spec' => '/video/%id%.%format%',
        						'defaults' => array(
        								'controller' => 'FrontEnd\Controller\Index',
        								'action'     => 'video',
        								'format'     => 'html',
        						),
        				),
        		),
        		
        		'product_type' => array(
        				'type' => 'Regex',
        				'options' => array(
        						'regex' => '/type/(?<id>[\/a-zA-Z0-9_-]+)(\.(?<format>(json|html|xml|rss)))?',
        						'spec' => '/type/%id%.%format%',
        						'defaults' => array(
        								'controller' => 'FrontEnd\Controller\Index',
        								'action'     => 'type',
        								'format'     => 'html',
        						),
        				),
        		),
        		
        		'ajax' => array(
        				'type' => 'Zend\Mvc\Router\Http\Literal',
        				'options' => array(
        						'route'    => '/product/ajax.html',
        						'defaults' => array(     		
        								'controller' => 'FrontEnd\Controller\Ajax',
        								'action'        => 'index',
        						),
        				),
        				        		
        		),
        		
        		
        		'add' => array(
        				'type' => 'Literal',
        				'options' => array(
        						'route'    => '/product/add.html',
        						'defaults' => array(
        								'controller'    => 'FrontEnd\Controller\Index',
        								'action'        => 'add',
        						),
        				),
        		),
        		'tet' => array(
        				'type' => 'Literal',
        				'options' => array(
        						'route'    => '/tet',
        						'defaults' => array(
        								'controller'    => 'FrontEnd\Controller\Index',
        								'action'        => 'tet',
        						),
        				),
        		),
            'applicationgdf' => array(
                'type'    => 'Literal',
                'options' => array(
                    'route'    => '/applicationSS',
                    'defaults' => array(
                        '__NAMESPACE__' => 'FrontEnd\Controller',
                        'controller'    => 'Index',
                        'action'        => 'index',
                    ),
                ),

            ),
        ),
    ),
    'service_manager' => array(
        'factories' => array(
            'translator' => 'Zend\I18n\Translator\TranslatorServiceFactory',
        ),
    ),
    'translator' => array(
        'locale' => 'en_US',
        'translation_file_patterns' => array(
            array(
                'type'     => 'gettext',
                'base_dir' => __DIR__ . '/../language',
                'pattern'  => '%s.mo',
            ),
        ),
    ),
    'controllers' => array(
        'invokables' => array(
            'FrontEnd\Controller\Index' => 'FrontEnd\Controller\IndexController',
        	'FrontEnd\Controller\Ajax' => 'FrontEnd\Controller\AjaxController',
        	'FrontEnd\Controller\Head' => 'FrontEnd\Controller\HeadController',
        	'FrontEnd\Controller\Rss' => 'FrontEnd\Controller\RssController',
        ),
    ),
		
    'view_manager' => array(
        'display_not_found_reason' => true,
        'display_exceptions'       => true,
        'doctype'                  => 'HTML5',
        'not_found_template'       => 'error/404',
        'exception_template'       => 'error/index',
        'template_map' => array(
            'layout/frontend'          => TEMPALATE_PATH . '/frontend/index.phtml',
            'error/404'               => __DIR__ . '/../view/error/404.phtml',
            'error/index'             => __DIR__ . '/../view/error/index.phtml',
        		'layout/menu/frontend'         => TEMPALATE_PATH . '/frontend/menu.phtml',
        		'layout/breadcrumbspro'  => TEMPALATE_PATH . '/frontend/breadcrumbs.phtml',
        		'layout/top/frontend'          => TEMPALATE_PATH . '/frontend/top.phtml',
        		'layout/footer/frontend'       => TEMPALATE_PATH . '/frontend/footer.phtml',
        		'layout/paginator/frontend'    => TEMPALATE_PATH . '/frontend/paginator.phtml',
        ),
        'template_path_stack' => array(
            __DIR__ . '/../view',
        ),
    		'strategies' => array(
    				'ViewFeedStrategy',
    		),
    ),
		
		'service_manager' => array(
				'initializers' => array(function ($instance, $sm) {
					if ($instance instanceof \Zend\Db\Adapter\AdapterAwareInterface) {
						$instance->setDbAdapter($sm->get('Zend\Db\Adapter\Adapter'));
					}
				}),
				'invokables' => array(
						'menu_frontend' => 'FrontEnd\Model\MenuTable'
				),
				'factories' => array(
						'Navigation_frontend' => 'FrontEnd\Navigation\NavigationFactory', // <-- add this
				),
		),
);
